<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/2
 * Time: 21:57
 */

namespace app\api\model;


class Order extends BaseModel
{
    protected $hidden = ['delete_time', 'update_time', 'create_time'];
    //获取定单页的数据
    public static function getSummerBuyUser($uid, $page=1, $size=5)
    {
        //查出的是一个对象
        $paginage = self::where(['user_id' => $uid]) -> order('create_time desc') -> paginate($size, true, ['page' => $page]);//等同于find和select
        return $paginage;
    }
    //获取定单祥情页的数据的获取器
    protected function getSnapAddressAttr($value)
    {
        if(empty($value)) return null;
        return json_decode($value, true);
    }
    protected function getSnapItemsAttr($value)
    {
        if(empty($value)) return null;
        return json_decode($value, true);
    }
}